# Replication package for 'Bin-Conditional Conformal Prediction of Fatalities from Armed Conflict'

## Overview

This package reproduces the results reported in the paper "Bin-Conditional Conformal Prediction of Fatalities from Armed Conflict" by David Randahl, Jonathan P. Williams, and Håvard Hegre. The package includes the code and data necessary to replicate the analysis and results presented in the paper. 

All results are replicated by running the `run.sh` script, which executes the main analysis and generates the figures and tables included in the paper by calling six R scripts. The run generates the figures and tables included in the paper, as well as approximately 2.3 GB of data files. One replication run takes about 6 hours to run on a 12-core Mac M2 with 32 GB of RAM. The replication is set to utilize all but one of the available cores on the machine. The scripts are set-up to prevent memory build-up issues (possible bug in the foreach package) by regularly clearing out the R subprocesses. Expected memory usage is around 1 GB of RAM per core.

## Data

This paper utilizes data from one of the thematic models of the Violence-Early Warning System (VIEWS) project. This data is available in the `data` folder in parquet format and are publicly available. Data is also generated in the simulation scripts, as part of the replication process. 

## Software and environment

- R version 4.4.3 with packages `tidyverse`, `ranger`, `magrittr`, `arrow`, `foreach`, `doParallel`, `doRNG`, `pintervals`. The replication script automatically checks and installs the required packages if they are not already installed.
- OS: macOS Seqouoia 15.4.1 (or other linux / macOS / Windows with adjustments). For a run on Windows, check the documentation of the `parallel` package to ensure that the parallelization is set up correctly.
- Resources: 
  - 12-core Mac M2 
  - 32 GB of RAM (expected memory usage is around 1 GB of RAM per core)
  - 0 GPU cores
- Runtime: 
  - 6 hours for the full replication run on the above machine
- Output: 
  - 4 figures in folder `figures`. Corresponding to the figures and figure numbers in the paper.
  - 2 tables in folder `tables`. Corresponding to the tables and table numbers in the paper.
  - 2.3 GB of data files (prediction interval files)






